﻿
@model OSBLE.Models.Courses.Course

@using OSBLE.Models


@{
    ViewBag.Title = "Create Course";
}

<h2>Create Course</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/osble.courses.js")" type="text/javascript"></script>

@using (Html.BeginForm("Create", "Course", FormMethod.Post, new { id = "course_submit" }))
{
    @Html.ValidationSummary(true)

    <h3>Course Information</h3>
    
    <table>
        <tr>
        
        <td>
        <div class="editor-label">
            @Html.LabelFor(model => model.Prefix)
            @Helpers.CreateToolTip(ToolTips.CoursePrefix)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Prefix, new { size = 6 })
        </div>
        </td>

        <td>
        <div class="editor-label">
            @Html.LabelFor(model => model.Number)
            @Helpers.CreateToolTip(ToolTips.CourseNumber)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Number, new { size = 4 })
        </div>
        </td>
        <td>
            <div class="editor-label">
            @Html.LabelFor(model => model.Name)
            @Helpers.CreateToolTip(ToolTips.CourseName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
        </div>

        </td>

        </tr>

        <tr>
        
        <td>
        <div class="editor-label">
            @Html.LabelFor(model => model.Semester)
            @Helpers.CreateToolTip(ToolTips.CourseTerm)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Semester, new { size = 6 })
            
        </div>
        </td>

        <td>

        <div class="editor-label">
            @Html.LabelFor(model => model.Year)
            @Helpers.CreateToolTip(ToolTips.CourseYear)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Year, new { size = 4 })
            
        </div>

        </td>

        </tr>
    </table>
    
    <h3>Course Schedule</h3>
    
    <table>
    <tr>
        <td>
            <div class="editor-label">
            @Html.LabelFor(model => model.StartDate, "Start Date")
            @Helpers.CreateToolTip(ToolTips.CourseStartDate)

        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.StartDate)<br />
            @Html.ValidationMessageFor(model => model.StartDate)
        </div>
        </td>
        <td>
        <div class="editor-label">
            @Html.LabelFor(model => model.EndDate, "End Date")
            @Helpers.CreateToolTip(ToolTips.CourseEndDate)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.EndDate)<br />
            @Html.ValidationMessageFor(model => model.EndDate)
        </div>
        </td>
    </tr>
    
    </table>
    
    <h4>Meeting Times @Helpers.CreateToolTip(ToolTips.CourseMeetingTimes) </h4>
    
    <div id="meeting_times">

    </div>
    
    <div id="meetings_after">
    <a href="#" onclick="addMeetingTime(); return false;" title="Add Meeting Time">@Helpers.AddButton()</a>
    </div>
  
   
    <input type="hidden" id="meetings_max" name="meetings_max" value="0" />
    
    <h4>Breaks/Holidays @Helpers.CreateToolTip(ToolTips.CourseBreaks) </h4>

    <div id="breaks">
    </div>
    
    <div id="breaks_after">
    <a href="#" onclick="addBreak(); return false;" title="Add Break Time">@Helpers.AddButton()</a>
    </div>
        
    <input type="hidden" id="breaks_max" name="breaks_max" value="0" />
    
        <div class="editor-field">
            @Html.CheckBoxFor(model => model.ShowMeetings) @Html.LabelFor(model => model.ShowMeetings) <br />
            @Html.ValidationMessageFor(model => model.ShowMeetings)
        </div>
    
    <h3>Course Settings </h3>
    
        <div class="editor-field">
            @Html.CheckBoxFor(model => model.AllowDashboardPosts) @Html.LabelFor(model => model.AllowDashboardPosts)
            @Helpers.CreateToolTip(ToolTips.CourseStudentPost) <br />
            @Html.ValidationMessageFor(model => model.AllowDashboardPosts)
        </div>

        <div class="editor-field">
            @Html.CheckBoxFor(model => model.AllowDashboardReplies) @Html.LabelFor(model => model.AllowDashboardReplies)
            @Helpers.CreateToolTip(ToolTips.CourseStudentReply) <br />
            @Html.ValidationMessageFor(model => model.AllowDashboardReplies)
        </div>

        <div class="editor-field">
            @Html.CheckBoxFor(model => model.AllowEventPosting, new { onchange = "if($(this).attr('checked')){$('#require_approval').show('highlight');}else{$('#require_approval').hide('highlight');}" }) @Html.LabelFor(model => model.AllowEventPosting)
            @Helpers.CreateToolTip(ToolTips.CourseStudentEvent) <br />
            @Html.ValidationMessageFor(model => model.AllowEventPosting)
        </div>

        <div class="editor-field" id="require_approval" @if (!Model.AllowEventPosting)
                                                        {<text>style="display: none;"</text>}>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            @Html.CheckBoxFor(model => model.RequireInstructorApprovalForEventPosting) @Html.LabelFor(model => model.RequireInstructorApprovalForEventPosting)
            @Helpers.CreateToolTip(ToolTips.CourseInstructorEventApproval) <br />
            @Html.ValidationMessageFor(model => model.RequireInstructorApprovalForEventPosting)
        </div>

        <div class="editor-field">
            @Html.CheckBoxFor(model => model.Inactive) @Html.LabelFor(model => model.Inactive) 
            @Helpers.CreateToolTip(ToolTips.CourseInactive) <br />
            @Html.ValidationMessageFor(model => model.Inactive)
        </div>


        <br />
        <div class="editor-field">
            @Html.LabelFor(model => model.CalendarWindowOfTime)
            @Html.TextBoxFor(model => model.CalendarWindowOfTime, new { size = 3 })
            @Helpers.CreateToolTip(ToolTips.CourseCalendarEvents) 
        </div>
    
    <h3>Default Grading Scheme @Helpers.CreateToolTip(ToolTips.CourseGradingScheme) </h3>
        <div class="letterGrades" id="letterGradesID">
            <table class="letterGradesTable" id="letterGradesTableID">
            @{
                <input type="hidden" id="max_table" name="max_table" value="11" />

                <tr>
                    <th>Letter Grade</th>
                    <th>Minimum % Required</th>
                </tr>
		        <tr id="values">
			        <td><input name="letter-0" value="A" /></td>
			        <td><input name="min-0" value="93" /></td>
		        </tr>
		        <tr id="values">
			        <td><input name="letter-1" value="A-" /></td>
			        <td><input name="min-1" value="90" /></td>
		        </tr>
		        <tr id="values">
			        <td><input name="letter-2" value="B+" /></td>
			        <td><input name="min-2" value="87" /></td>
		        </tr>
		        <tr id="values">
			        <td><input name="letter-3" value="B" /></td>
			        <td><input name="min-3" value="83" /></td>
		        </tr>
		        <tr id="values">
			        <td><input name="letter-4" value="B-" /></td>
			        <td><input name="min-4" value="80" /></td>
		        </tr>
		        <tr id="values">
			        <td><input name="letter-5" value="C+" /></td>
			        <td><input name="min-5" value="77" /></td>
		        </tr>
		        <tr id="values">
			        <td><input name="letter-6" value="C" /></td>
			        <td><input name="min-6" value="73" /></td>
		        </tr>
		        <tr id="values">
			        <td><input name="letter-7" value="C-" /></td>
			        <td><input name="min-7" value="70" /></td>
		        </tr>
		        <tr id="values">
			        <td><input name="letter-8" value="D+" /></td>
			        <td><input name="min-8" value="67" /></td>
		        </tr>
		        <tr id="values">
			        <td><input name="letter-9" value="D" /></td>
			        <td><input name="min-9" value="63" /></td>
		        </tr>
		        <tr id="values">
			        <td><input name="letter-10" value="F" /></td>
			        <td><input name="min-10" value="0" /></td>
		        </tr>
            }
	        </table>
            <a href="#" onclick="addTableRow(); return false;" title="Add New Letter Grade">@Helpers.AddButton()</a>
            <a href="#" onclick="removeTableRow(); return false;" title="Remove Last Letter Grade">@Helpers.DeleteButton()</a>
        </div>
        
    <h3>Default Late Policy @Helpers.CreateToolTip(ToolTips.CourseLatePolicy) </h3>
    
    <p>
        Students may submit assignments up to @Html.TextBoxFor(model => model.MinutesLateWithNoPenalty, new { size = 3 })
        minutes late at no penalty, after which a penalty of @Html.TextBoxFor(model => model.PercentPenalty, new { size = 3 })
        percent per @Html.TextBoxFor(model => model.HoursLatePerPercentPenalty, new { size = 3 })
        hours late will be applied.<br />
        @Html.ValidationMessageFor(model => model.MinutesLateWithNoPenalty)
        @Html.ValidationMessageFor(model => model.PercentPenalty)
        @Html.ValidationMessageFor(model => model.HoursLatePerPercentPenalty)
    </p>
    
    
    <p>
        Assignments that are submitted more than @Html.TextBoxFor(model => model.HoursLateUntilZero, new { size = 3 })
        hours after the due date and time will receive an automatic 0.<br />
        @Html.ValidationMessageFor(model => model.HoursLateUntilZero)
    </p>
  
        <br />
        <p>
            <input type="submit" id="course_submit" value="Create Course" />
        </p>
}

